#include<iostream>

using namespace std;


int main()
{
    int n; cin >> n;
    while (n--)
    {
        char s; cin >> s;
        double h; cin >> h;
        if (s == 'M') printf("%.2lf\n", h / 1.09);
        else printf("%.2lf\n", h * 1.09);
    }
    return 0;
}